streamText

fun streamText(model: LanguageModel, prompt: String? = null, messages: List<ModelMessage> = emptyList(), system: String? = null, temperature: Float? = null, topP: Float? = null, topK: Int? = null, maxOutputTokens: Int? = null, stopSequences: List<String> = emptyList(), seed: Int? = null, providerOptions: Map<String, JsonElement> = emptyMap(), abortSignal: AbortSignal = AbortSignalNever, output: Output<*>? = null, presencePenalty: Float? = null, frequencyPenalty: Float? = null, responseFormat: ResponseFormat = ResponseFormat.Text): Flow<StreamEvent>

Streaming generation — invariant I-3. Returns a cold Flow that drives one upstream call when collected. For tool-loop agents, use Agent.stream instead.


fun streamText(model: LanguageModel, settings: CallSettings = CallSettings(), block: TextGenerationRequestBuilder.() -> Unit): Flow<StreamEvent>